// 封装本地存储
const TOKEN_NAME = 'hm-25-sq'
const CHANNEL_NAME = 'hm-news-channel-list'
const HISTROYLIST_NAME = 'hm-historyList-list'

export function setStorageToken(platlode) {
  localStorage.setItem(TOKEN_NAME, JSON.stringify(platlode))
}

export function getStorageToken() {
  return JSON.parse(localStorage.getItem(TOKEN_NAME)) || {}
}

export function removeStorageToken() {
  localStorage.removeItem(TOKEN_NAME)
}

// 本地存储 我的频道
export function setStroageChannel(platlode) {
  localStorage.setItem(CHANNEL_NAME, JSON.stringify(platlode))
}

export function getStroageChannel() {
  return JSON.parse(localStorage.getItem(CHANNEL_NAME))
}

// 搜索历史记录 本地存储
export function setHistoryList(platlode) {
  // localStorage.setItem(HISTROYLIST_NAME, JSON.stringify(platlode)) || []
  // eslint-disable-next-line no-unused-expressions
  localStorage.setItem(HISTROYLIST_NAME, JSON.stringify(platlode))
}

export function getHistoryList() {
  return JSON.parse(localStorage.getItem(HISTROYLIST_NAME)) || []
}
